package com.qf.controller;

import com.qf.entity.Product;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@RequestMapping("/product")
public class ProductController {

    @GetMapping("/{name}")
    public Product getbyName(@PathVariable("name") String name){
        Product product = new Product(1, name, "/img/1.jpg", new BigDecimal("100"));
        return product;
    }

    @GetMapping("/getbyid")
    public Product getbyid(Integer id){
        Product product = new Product(id, "华为手机", "/img/2.jpg", new BigDecimal("10000"));
        return product;
    }


}
